Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

🐛 Ignore collection failures in non-tests #1

Closed
wants to merge 36 commits into from

Conversation

stdedos
Copy link

@stdedos stdedos commented Feb 24, 2023

This change applies the pre-existing patterns to identify if the files with collection problems are tests. It is then used to eliminate the false-positives of F6401 (cannot-enumerate-pytest-fixtures).

As a side effect, this patch also includes precise file paths that may be used to reproduce the problem.

Fixes reverbc#20
Fixes reverbc#21

Replayed; Source PR: reverbc#22

Additionally:

Improve F6401:cannot-enumerate-pytest-fixtures:

  • Capture and return stdout and stderr (instead of trashing them)
  • Fix the 'duplicate-path' error by relative-izing the paths before unioning them
  • Update tests to test for both conditions

Additionally:

  • pylint-pytest does not support pylint>=3
  • Fix two used-before-assignment pylint issues (stdout, stderr) 🤪

Signed-off-by: Stavros Ntentos [email protected]

stdedos and others added 10 commits October 14, 2023 11:59
… only `pylint<3`, coverage at Codecov, drop other CI

Signed-off-by: Stavros Ntentos <[email protected]>
CI: Use GH-Actions, drop the rest, MOAR Pythons, MOAR OSes, coverage at Codecov

Additionally:
* Update `.gitignore`
* Mark the plugin supporting only `pylint<3`
Store all tools' configurations in `pyproject.toml`,
even if right now only the `setup.py` file is used.

Keep `.pylintrc` separately.
It is 300 lines; default `--generate-toml-config` gives 600 😅

Comment-out hooks that need >0 work to be green.

Signed-off-by: Stavros Ntentos <[email protected]>
Signed-off-by: Stavros Ntentos <[email protected]>
Pierre-Sassoulas and others added 16 commits October 15, 2023 11:48
Most of the issues are "almost clear-cut", except the
astroid stuff - `pylint_pytest/checkers/class_attr_loader.py`.

Those were mostly placated (but hopefully done right).

Additionally, add some sanity features to `BasePytestTester`:
* Marked class as `ABC`
* Enforce subclasses to initialize `MSG_ID`

Mostly both of those changes are "aesthetical",
and do not contribute to strict guarantees of behavior, or type assertions.

But at least `pytest` cries loudly when used wrong - so that's something.

Signed-off-by: Stavros Ntentos <[email protected]>
... and `f{msg_id=}`

Signed-off-by: Stavros Ntentos <[email protected]>
Signed-off-by: Stavros Ntentos <[email protected]>
* Configure action `concurrency:`
* Use `codecov/codecov-action@v3` flags (might ... help codecov, somehow)
* Upload testing artifacts
* Add the Codecov badge in the README.md

Signed-off-by: Stavros Ntentos <[email protected]>
* Drop `py312` to combat #16
* Install `--editable`, so that Python uses the correct source files for coverage
* Ignore `tests/input/**/*.py` from coverage - they are not ran properly
* Again improve on artifact naming

Signed-off-by: Stavros Ntentos <[email protected]>
stdedos and others added 9 commits October 19, 2023 09:55
Additionally, fixes #13

Signed-off-by: Stavros Ntentos <[email protected]>
* Drop `tests/*` both from `sdist` and `wheel`
* Drop `universal` wheel (we don't support Python2)

Signed-off-by: Stavros Ntentos <[email protected]>
currently, both fixture in this example are flagged has not fixtures
```python
from pytest import fixture

@fixture
def my_fixture(): pass

@fixture(name="foo")
def my_fixture_2(): pass
```
This is due to the different semantics in astroid when using `import pytest` or `from pytest import ...`
Signed-off-by: Stavros Ntentos <[email protected]>
This change applies the pre-existing patterns to identify if the files with collection problems are tests. It is then used to eliminate the false-positives of F6401 (cannot-enumerate-pytest-fixtures).

As a side effect, this patch also includes precise file paths that may be used to reproduce the problem.

Fixes reverbc#20
Fixes reverbc#21

Signed-off-by: Sviatoslav Sydorenko <[email protected]>

_Replayed; Source PR: https://github.com/reverbc/pylint-pytest/pull/22_

Additionally, satisfied the https://github.com/pylint-dev/pylint-pytest's `.pre-commit-config.yaml`

Signed-off-by: Stavros Ntentos <[email protected]>
* Capture and return `stdout` and `stderr` (instead of trashing them)
* Fix the 'duplicate-path' error by `relative`-izing the paths before `union`ing them
* Update tests to test for both conditions

Additionally, fix two `used-before-assignment` pylint issues (`stdout`, `stderr`) 🤪

Signed-off-by: Stavros Ntentos <[email protected]>
@stdedos stdedos closed this Oct 23, 2023
@stdedos stdedos deleted the fix/21-exclude-non-tests branch October 23, 2023 08:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]Why does adding a module produce F6401 0.3.0 found my fixtures; 1.1.2 cannot.
3 participants